﻿using CatUtils.Utils.Currency.IoUtils;
using System;
using System.Windows.Forms;

namespace RabbitDownload.WebSite.Ehentai
{
    public partial class EhentatControl : UserControl
    {
        public EhentatControl()
        {
            InitializeComponent();

            InitView();
        }

        private void InitView()
        {
            comboBox2.Items.AddRange(new object[] { 1, 2, 3, 4, 5 });
            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 4;
        }

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            Helper.ViewHelper.TextBoxHelper.PrintCount(e);
        }

        private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
        {
            Helper.ViewHelper.TextBoxHelper.PrintCount(e);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            EHentaiScanner.Start(textboxOnlyCount1.Text, textboxOnlyCount2.Text,
                comboBox2.Text, EhentaiHelper.GetClassify(comboBox1.Text),
                checkBox2.Checked);
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            EhentaiHelper.PreviewMode = checkBox1.Checked;
            EhentaiHelper.PreviewModeCount = 30;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            new EHentaiScanner().SaveArticleList(textboxOnlyCount1.Text, textboxOnlyCount2.Text,
                comboBox2.Text, EhentaiHelper.GetClassify(comboBox1.Text));
        }

        private void button3_Click(object sender, EventArgs e)
        {
            new EHentaiScanner().DownloadListFile(FileHelper.SelectFile());
        }
    }
}